package ah.com.ddh.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class RefererAction extends DispatchAction {

	public ActionForward refer(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		String referer = request.getHeader("Referer");
		
		StringBuilder strBuilder = new StringBuilder();
		strBuilder.append(request.getRequestURI());
		strBuilder.append("?");
		strBuilder.append(request.getQueryString());
		
		request.setAttribute("referer", strBuilder.toString());
		request.setAttribute("referer2", request.getRequestURL());
		
		return new ActionForward("/refer.jsp");
	}
	
}
